/**
 * Created by haoli on 3/13/14.
 */
var connection = require('../db/mysql');
var dbconf = require('../conf/dataconfige');
var table = dbconf.prefix+"qappvote_option";

function QappVoteOption( voteOption ){
    this.id = voteOption.id
    this.option_name = voteOption.option_name;
    this.option_id = voteOption.option_id;
    this.vote_id = voteOption.vote_id;
    this.image = voteOption.image;
    this.listorder = voteOption.listorder;
    this.stat = voteOption.stat;
    this.topbegin = voteOption.topbegin;
    this.topend = voteOption.topend;
};

module.exports = QappVoteOption;

QappVoteOption.prototype.getVoteOptionByVoteId = function(callback){
    sqlStr = "select * from "+ table + " where id = " + this.vote_id;
    connection.query(sqlStr,function(err,result){
        if( err ){
        }else{
            callback( err,result );
        }
    });
}
